<?php
/**
 * Created by PhpStorm.
 * User: HP
 * Date: 2021/6/8
 * Time: 9:25
 */

namespace app\backend\validate;

use think\Validate;
class ListingValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'title' => 'require',
        'classify_id' => 'require',

    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'title.require' => '请输入标题',
        'classify_id.require' => '请选择分类',
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'create' => ['title','classify_id'],
        'update' => ['title','classify_id']
    ];
}